#!/bin/bash

WORKSPACE="$(pwd)"
export WORKSPACE

# i.e. source and export the variables
export $(cat .ci/java-versions.properties | grep '=' | xargs)

JAVA_HOME="$HOME/.java/$ESH_BUILD_JAVA"
export JAVA_HOME

RUNTIME_JAVA_HOME="$HOME/.java/$ESH_RUNTIME_JAVA"
export RUNTIME_JAVA_HOME

JAVA7_HOME="$HOME/.java/java7"
export JAVA7_HOME

JAVA8_HOME="$HOME/.java/java8"
export JAVA8_HOME

JAVA9_HOME="$HOME/.java/java9"
export JAVA9_HOME

JAVA10_HOME="$HOME/.java/java10"
export JAVA10_HOME

JAVA11_HOME="$HOME/.java/java11"
export JAVA11_HOME

JAVA12_HOME="$HOME/.java/openjdk12"
export JAVA12_HOME

JAVA13_HOME="$HOME/.java/openjdk13"
export JAVA13_HOME

JAVA14_HOME="$HOME/.java/openjdk14"
export JAVA14_HOME

if [[ "$USE_DRA_CREDENTIALS" == "true" ]]; then
  DRA_VAULT_ROLE_ID_SECRET=$(vault read -field=role-id secret/ci/elastic-elasticsearch-hadoop/legacy-vault-credentials)
  export DRA_VAULT_ROLE_ID_SECRET

  DRA_VAULT_SECRET_ID_SECRET=$(vault read -field=secret-id secret/ci/elastic-elasticsearch-hadoop/legacy-vault-credentials)
  export DRA_VAULT_SECRET_ID_SECRET

  DRA_VAULT_ADDR=https://secrets.elastic.co:8200
  export DRA_VAULT_ADDR
fi
